package chapter.tenth.item69;

import java.util.concurrent.CountDownLatch;

class Worker implements Runnable {
	   private final CountDownLatch startSignal;
	   private final CountDownLatch doneSignal;
	   private final String name;
	   Worker(CountDownLatch startSignal, CountDownLatch doneSignal
			   ,String name) {
	     this.startSignal = startSignal;
	     this.doneSignal = doneSignal;
	     this.name = name;
	   }
	   public void run() {
	     try {
	       startSignal.await();
	       doWork();
	       //doneSignal.countDown();
	     } catch (InterruptedException ex) {} // return;
   }

   void doWork() {
	   System.out.println(this.name);
   }
}
